﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MySQLEntityConnectTest._Default" %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <!-- Для удобства помещаем все елементы управления в Update Panel -->
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                
                <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="id" 
                    DataSourceID="EntityDataSource1" ForeColor="#333333" 
                    RepeatDirection="Horizontal">
                    <AlternatingItemStyle BackColor="White" />
                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                    <ItemStyle BackColor="#E3EAEB" />
                    <ItemTemplate>
                        id:
                        <asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
                        <br />
                        name:
                        <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                        <br />
                        address:
                        <asp:Label ID="addressLabel" runat="server" Text='<%# Eval("address") %>' />
                        <br />
                        city:
                        <asp:Label ID="cityLabel" runat="server" Text='<%# Eval("city") %>' />
                        <br />
                        state:
                        <asp:Label ID="stateLabel" runat="server" Text='<%# Eval("state") %>' />
                        <br />
                        zip:
                        <asp:Label ID="zipLabel" runat="server" Text='<%# Eval("zip") %>' />
                        <br />
                        <br />
                    </ItemTemplate>
                    <SelectedItemStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                </asp:DataList>



                <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
                    ConnectionString="name=testEntities" DefaultContainerName="testEntities" 
                    EntitySetName="customer" EntityTypeFilter="customer">
                </asp:EntityDataSource>



                <asp:Label runat="server" ID="CustomerName" Text="<Name will be here>"></asp:Label><br />
                Enter user id: <asp:TextBox ID="userID" runat="server"></asp:TextBox><br />
                <asp:Button ID="GetCustomer" runat="server" Text="Get from MySQL" 
                    onclick="GetCustomer_Click" />

            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="GetCustomer" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
